package com.cloud.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cloud.mapper.SalesmanMapper;
import com.cloud.pojo.Salesman;
import com.cloud.pojo.SalesmanExample;
import com.cloud.pojo.SalesmanExample.Criteria;
import com.cloud.service.SalesmanService;

/**
 *@Author: liu
 *@Date: Created on 2017年11月3日 下午4:27:43
 */
@Service
public class SalesmanServiceImpl implements SalesmanService {
	
	@Autowired
	private SalesmanMapper salesmanMapper;

	@Override
	public Salesman selectSalesmanByUsername(Salesman salesman) {
		// TODO Auto-generated method stub
		SalesmanExample example = new SalesmanExample();
		Criteria criteria = example.createCriteria();
		criteria.andUsernameEqualTo(salesman.getUsername());
		List<Salesman> list = salesmanMapper.selectByExample(example);
		if(list != null && list.size() > 0){
			return list.get(0);
		}
		return null;
	}

}
